<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="no"/>

  <xsl:template match="testrun">
  <html>
  <body>
  <h2>Testrun: <xsl:value-of select="@name" /></h2>
    
    <xsl:text>
    Tests run: </xsl:text>
    <xsl:value-of select="@tests" />
    <xsl:text>, Failures: </xsl:text>
    <xsl:value-of select="@failures" />
    <xsl:text>, Errors: </xsl:text>
    <xsl:value-of select="@errors" />
    <xsl:text>, Time elapsed: </xsl:text>
    <xsl:value-of select="@time" />
    <xsl:text> sec</xsl:text>

	<br /><br />	
 	<table border="1">
	<col width="200" />
	<col width="400" />
	<col width="50" />
	<col width="400" />
	<tr>
		<td><b>testsuite</b></td>
		<td><b>testcase</b></td>
		<td><b>result</b></td>
		<td><b>comment</b></td>
	</tr>
	<xsl:for-each select="testsuite/testcase">
	<tr>
      <td><xsl:value-of select="@classname"/></td>
      <td><xsl:value-of select="@name"/></td>
      <xsl:choose>
        <xsl:when test="failure">
          <td bgcolor="#ff0000">failure</td><td>
          <xsl:value-of select="substring-after( substring-before( failure, 'at '), ':')"/></td>
        </xsl:when>
        <xsl:when test="error">
          <td bgcolor="#ff0000">error</td><td>
		  <xsl:value-of select="substring-before( error, '&#13;')"/></td>
        </xsl:when>
        <xsl:otherwise>
          <td bgcolor="#00ff00">succes</td>
		  <td></td>
        </xsl:otherwise>
      </xsl:choose>

	</tr>
	</xsl:for-each>
	</table>
 
   </body>
  </html>
 </xsl:template>

</xsl:stylesheet>
